package com.moter.demo01.io.reader_writer.string;



import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;

public class StringReaderDemo {
    public static void main(String[] args) throws IOException {
        StringWriter stringWriter = new StringWriter();
        stringWriter.write("name:\t");
        stringWriter.append("moter,").append("\tage:\t").append("21");
        StringBuffer buffer = stringWriter.getBuffer();

        StringReader stringReader = new StringReader(new String(buffer));
        char[] bytes = new char[1024];

        stringReader.read(bytes);
        System.out.println(new String(bytes));
        stringReader.close();
        stringWriter.close();
    }
}
